package com.example.service.impl;

import com.example.dao.UserDao;
import com.example.po.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import javax.servlet.http.HttpSession;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public boolean findUser(User user, HttpSession session) {
        User findUser=userDao.findUser(user);
        //如果登录失败
        if(findUser==null){
            return false;
        }else{
            session.setAttribute("user",findUser);
            return true;
        }
    }
    @Override
    public boolean updateUserPassword(User user) {
        int i = userDao.updateUserPassword(user);
        if(i>0){
            return true;
        }else{
            return false;
        }
    }
}
